package listbyorder.access001_100.test70;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/6/3 21:31
 */
public class Solution1 {

    // 爬楼梯问题
    public int climbStairs(int n) {
        if (n < 2) return 1;
        int[] dp = new int[n + 1];
        for (int i = 0; i <= n; i++) {
            if (i < 2) {
                dp[i] = 1;
            } else {
                dp[i] = dp[i - 1] + dp[i - 2];
            }
        }
        return dp[n];
    }
}
